insert overwrite table jms_dm.dm_netmng_month_order_sign_summary_dt partition (dt)
select trunc(input_time, 'MM')             as month_first_day --月的第一天
     , count(1)                            as mon_num         --下单量
     , sum(if(nvl(is_sign, 0) <> 0, 1, 0)) as mon_sign_num    --下单量中签收的单
     , '{{ execution_date | cst_ds }}'                        as date_time       --t-1 天
     , '{{ execution_date | cst_ds }}'                        as dt              --t-1 天
from jms_dwd.dwd_yl_oms_oms_waybill_incre_dt
where dt >= add_months(trunc('{{ execution_date | cst_ds }}', 'MM'), -1)
  and dt <= '{{ execution_date | cst_ds }}'
group by trunc(input_time, 'MM')
distribute by dt
;

